import request from "@/utils/request.js";

export const organizationApi = {
    // 获取组织机构树
    tree: () => request.get('/sysOrganization/tree'),
    // 按照父节点编码获取子节点列表
    listByParentCode: (parentCode) => request.get(`/sysOrganization/list/parentCode`, {params: {parentCode}}),
    // 根据ID获取
    getById: (id) => request.get(`/sysOrganization/${id}`),
    // 根据ID删除
    delete: (id) => request.delete(`/sysOrganization/${id}`),
    // 批量删除
    deleteBatch: (ids) => request.delete('/sysOrganization/batch', {
        params: {
            ids: ids.join(',')
        }
    }),
    // 新增
    create: (data) => request.post('/sysOrganization', data),
    // 更新
    update: (data) => request.put('/sysOrganization', data)
}